package com.autumn.mybatis.provider.mysql.builder;

import com.autumn.mybatis.metadata.EntityTable;
import com.autumn.mybatis.provider.builder.AbstractDeleteBuilder;
import com.autumn.mybatis.provider.mysql.MySqlProvider;
import com.autumn.mybatis.provider.mysql.MySqlUtils;
import com.autumn.mybatis.provider.util.MybatisSqlUtils;

/**
 * MySql 删除生成器
 * 
 * @author 杨昌国
 *
 *         2017-10-19 08:41:06
 */
public class MySqlDeleteBuilder extends AbstractDeleteBuilder {

	/**
	 * 
	 * @param dbProvider
	 */
	public MySqlDeleteBuilder(MySqlProvider dbProvider) {
		super(dbProvider);
	}

	@Override
	public String getDeleteByWhereSql(EntityTable table, String parmaName) {
		StringBuilder sql = new StringBuilder();
		sql.append("DELETE FROM ");
		sql.append(MybatisSqlUtils.getTableOrViewName(table));
		sql.append(MySqlUtils.createSectionWhereSql(parmaName));
		return sql.toString();
	}

}
